<div style="text-align: center; padding:5px 10px; border-bottom: #aaa solid 1px;">
    <?php echo CHtml::beginForm(); ?>
    Category：
    <?php
    require_once(Yii::app()->basePath . '/extensions/GraphTree/tree.php');
    $datas = MediaCategory::model()->getCTreeViewDatas();
    $datas = dumpArrayTree($datas);
    $trees = array('1' => 'ΞΞ NODE ROOT ΞΞ');
    if (count($datas)) {
        foreach ($datas as $data) {
            $trees[$data['id']] = $data['levelstr'] . '⇒ ' . strip_tags($data['text']) . '《' . (string)$data['files_count'] . '》';
        }
    }
    echo CHtml::dropDownList('category_id', 1, $trees,
        array('size' => 1, 'class' => 'dropdown', 'ajax' => array(
                'type' => 'GET',
                'url' => array('showCategoryMediaList'),
                'update'=>'#media_lists',
                'beforeSend' => 'function() { $("#media_lists").addClass("datasLoading"); }',
                'complete' => 'function() { $("#media_lists").removeClass("datasLoading"); }',
            ),
            'prompt'=>'Please Select Category'
        ));
    echo CHtml::hiddenField('element_id', $element_id);
    echo CHtml::endForm();
    ?>
</div>
<input type="button" class="nyroModalClose" value="checked and return" onclick="fnClick();" />
<div id="media_lists" style="height: 350px; overflow: auto;"></div>

<script type="text/javascript">
    function fnClick() {
        var path = $("input[name='media_id']:checked").val();
        $("#<?php echo $element_id; ?>").val(path);
    }
    function fnReturnPath(id, path) {
        $('#radio_' + id).attr('checked', true);
        $("#" + id + " > a").addClass('selected');
    }
</script>